<!DOCTYPE HTML>
<html>
<head>
<script src="__PUBLIC__/Admin/Js/jquery.js"></script>
<script src="__PUBLIC__/Admin/Js/jquery-ui-1.12.0.custom/jquery-ui.min.js"></script>
<link rel="stylesheet" href="__PUBLIC__/Admin/Js/jquery-ui-1.12.0.custom/jquery-ui.min.css">
<meta charset="utf-8">
<link type="text/css" rel="stylesheet" href="__PUBLIC__/Admin/tuan/css/H-ui.css"/>
<link type="text/css" rel="stylesheet" href="__PUBLIC__/Admin/tuan/css/H-ui.admin.css"/>
<link type="text/css" rel="stylesheet" href="__PUBLIC__/Admin/tuan/font/font-awesome.min.css"/>
<title>活动管理</title>
  <style>
  .msg{width:150px;height:50px;background-color: red;display:none;}
  </style>
</head>
<body>
<nav class="Hui-breadcrumb"><i class="icon-home"></i> 首页 <span class="c-gray en">&gt;</span> 活动中心 <span class="c-gray en">&gt;</span> 活动管理 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="icon-refresh"></i></a></nav>
<div class="pd-20">
	  <div class="text-c"> 日期范围：
		<input type="text" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}'})" id="datemin" class="input-text Wdate" style="width:120px;">
		-
		<input type="text" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d'})" id="datemax" class="input-text Wdate" style="width:120px;">
		<input type="text" class="input-text" style="width:250px" placeholder="输入会员名称、电话、邮箱" id="" name=""><button type="submit" class="btn btn-success" id="" name=""><i class="icon-search"></i> 搜用户</button>
	  </div>
	  <div class="cl pd-5 bg-1 bk-gray mt-20">
		<span class="l">
		<a href="<{:U('Link/add')}>" onClick="user_add('550','','添加用户','user-add.html')" class="btn btn-primary radius"><i class="icon-plus"></i> 添加商品</a></span> 
	  </div>
	  <div></div>
	  <table class="table table-border table-bordered table-hover table-bg table-sort">
		<thead>
		  <tr class="text-c">
			<th width="20">ID</th>
			<th width="100">名称</th>
			<th width="90">链接地址</th>
			<th width="80">操作</th>
		</tr>

		<foreach name="arr" item="vo">
		<tr class="text-c" id="user_<{$vo.id}>">
			<td><{$vo.id}></td>
			<td><{$vo.urlname}></td>
			<td><{$vo.urladdr}></td>
			<td class="f-14 user-manage"> 
			<!-- <a title="编辑" href="<{:U('Link/edit')}>?uid=<{$vo.id}>" onClick="user_edit('4','550','','编辑','<{:U("Link/edit")}>')" class="ml-5" style="text-decoration:none"><i class="icon-edit"></i></a>  -->
			<input data-uid="<{$vo['id']}>" type="button" name="bianji" value="编辑">
			<input data-uid="<{$vo['id']}>" type="button" name="shanchu" value="删除">
			</td>
			
		</tr>
		</foreach>
		
	</table>
	<div style="display:none" class="edit">
	<table>
	<tr><td>名    称:</td><td><input type="text" name="urlname" value=""></td></tr>
	<tr><td>链接地址:</td><td><input type="text" name="urladdr" value=""></td></tr>
	</table>
	</div>


<script>
  	$( function() {
  	$('[name="shanchu"]').click(function(){
  		var uid=$(this).attr("data-uid");
    $( "<div>是否确认删除</div>" ).dialog({
      resizable: false,
      title:"删除",
      height: "auto",
      width: 400,
      modal: true,
      buttons: {
			"确认删除": function() {
			  $( this ).dialog( "close" );
			  $.get('<{:U("del")}>',{uid:uid},function(data){
			if(data.status){				
				$('#user_'+uid).remove();
			}else{
				$('#user_'+uid+' [name="shanchu"]').val('删除');
				}			
			},'json');
			},
			"取消": function() {
			  $( this ).dialog( "close" );
			}
		  }
		});
	});
});

	//修改的弹窗
  $( function() {
	$('[name="bianji"]').click(function(){
		var uid = $(this).attr('data-uid');
		console.log(uid);
		//$('.edit [name="uid"]').val(uid);
		$.get('<{:U("chaxun")}>',{uid:uid},function(data){
			
			$('.edit [name="urlname"]').val(data.urlname);
			$('.edit [name="urladdr"]').val(data.urladdr);
	
		},'json');

		$('.edit').dialog({
		  resizable: false,
		  title:"修改",
		  height: 330,
		  width: 380,
		  modal: true,
		  buttons: {
			"确认修改": function() {
				var urlname = $('.edit [name="urlname"]').val();
				var urladdr = $('.edit [name="urladdr"]').val();
			  
			  $.post('<{:U("doedit")}>',{uid:uid,urlname:urlname,urladdr:urladdr},function(data){
				$('#user_'+uid+' td:eq(1)').text(urlname);
				$('#user_'+uid+' td:eq(2)').text(urladdr);			
				},'json');
				$( this ).dialog( "close" );
				},
				"取消": function() {
				  $( this ).dialog( "close" );
			}
		  }
		});
	});
});

  </script> 
</body>
</html>

